home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / createdate.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.7 KB  |  61 lines

  1. <!--- This example shows how to use Createdate,
  2. Createdatetime, and createODBCdate --->
  3.  
  4. <HTML>
  5.  
  6. <HEAD>
  7. <TITLE>
  8. CreateDate Example
  9. </TITLE>
  10. </HEAD>
  11.  
  12. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  13. <BODY  bgcolor="#FFFFD5">
  14.  
  15. <H3>CreateDate Example</H3>
  16.  
  17. <CFIF IsDefined("form.year")>
  18. Your date value, presented using different CF date functions:
  19. <CFSET yourDate = CreateDate(form.year, form.month, form.day)>
  20.  
  21. <CFOUTPUT>
  22. <UL>
  23.     <LI>Built with CreateDate: #CreateDate(form.year, form.month, form.day)#
  24.     <LI>Built with CreateDateTime: #CreateDateTime(form.year, form.month, form.day, 12,13,0)#
  25.     <LI>Built with CreateODBCDate: #CreateODBCDate(yourDate)#
  26.     <LI>Built with CreateODBCDateTime: #CreateODBCDateTime(yourDate)#
  27. </UL>
  28.  
  29. <P>The same value can be formatted with dateFormat:
  30. <UL>
  31.     <LI>Built with CreateDate: #DateFormat(CreateDate(form.year, form.month, form.day), "mmm-dd-yyyy")#
  32.     <LI>Built with CreateDateTime: #DateFormat(CreateDateTime(form.year, form.month, form.day, 12,13,0))#
  33.     <LI>Built with CreateODBCDate: #DateFormat(CreateODBCDate(yourDate), "mmmm d, yyyy")#
  34.     <LI>Built with CreateODBCDateTime: #DateFormat(CreateODBCDateTime(yourDate), "d/m/yy")#
  35. </UL>
  36.  
  37.  
  38. </CFOUTPUT>
  39.  
  40. </CFIF>
  41.  
  42.  
  43. <CFFORM ACTION="createdate.cfm" METHOD="POST">
  44. <P>Please enter the year, month and day in integer format for 
  45. the date value you would like to view:
  46. <PRE>
  47. Year    <CFINPUT TYPE="Text" NAME="year" VALUE="1998" VALIDATE="integer" REQUIRED="Yes">
  48. Month    <CFINPUT TYPE="Text" NAME="month" VALUE="6" VALIDATE="integer" REQUIRED="Yes">
  49. Day    <CFINPUT TYPE="Text" NAME="day" VALUE="8" VALIDATE="integer" REQUIRED="Yes">
  50. </PRE>
  51. <P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">
  52.  
  53.  
  54. </CFFORM>
  55.  
  56.  
  57.  
  58. </BODY>
  59.  
  60. </HTML>       
  61.